package com.onlyyou.cart.entity;

import com.onlyyou.cart.info.CartInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;

/**
 * @Author: 小野
 * @Date: 2020/1/15 9:23
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Cart {
    private Long id;                    //购物车id
    private Long userId;                //用户id
    private Long stockId;               //商品id
    private String stockImage;          //商品图
    private String stockName;           //商品名称
    private BigDecimal stockPrice;      //商品单价
    private Integer num;                //购买数量
    public CartInfo buildInfo() {
        CartInfo cartInfo=new CartInfo();
        BeanUtils.copyProperties(this,cartInfo);
        return cartInfo;
    }
}
